#! /bin/bash
nowDateStr=`date +%Y%m%d`
serialNumber=1
filenameData=./filenameData
if [ -f $filenameData  ]; then
  eval $(cat $filenameData|awk '{printf("oldDateStr=%s;serialNumber=%d", $1,$2)}')
  echo "========oldDataFile:${oldDateStr},serialNumber:${serialNumber}"
  if [ $nowDateStr != $oldDateStr ] ; then 
    serialNumber = 1
  fi
fi
#echo "------$nowDateStr,$serialNumber-----------"

#printf "%02d\n" $serialNumber 
echo $nowDateStr `printf "%02d\n" $serialNumber`
let serialNumber+=1
serialNumberStr=`printf "%02d\n" $serialNumber`
echo ${nowDateStr} ${serialNumberStr} > $filenameData
filename=${nowDateStr}-${serialNumberStr}
echo ${filename}

